package com.xlh.param.user;

import com.xlh.constant.UserConstant;
import com.xlh.util.InputValidator;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;

/**
 * 修改班级参数
 * <p>
 * Created by lx on 2019/3/19 0019.
 */
@Data
public class UpdateClassParam {

    @ApiModelProperty(value = "年级")
    @NotBlank(message = "请输入年级")
    @Length(max = 4, message = "年级不能超过4个字符")
    @Pattern(regexp = UserConstant.REGEX_NUMBER, message = "年级必须是数字")
    private String grade;

    @ApiModelProperty(value = "班级名称")
    @NotBlank(message = "请输入班级名称")
    @Length(max = 20, message = "班级名称不能超过20个字符")
    private String name;

    public String getName() {
        return name == null ? null : InputValidator.regSpecialChar(name);
    }

    public String getGrade() {
        return grade == null ? null : InputValidator.regSpecialChar(grade);
    }

}
